package org.lingshi.service.impl;


import org.lingshi.entity.SysUser;
import org.lingshi.utils.FileUploader;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public interface UserService {
    //1.查询用户信息
    SysUser getUserByName(String username);
    //2.查询用户列表
    PageBean<SysUser> list(QueryParam param);
    //4.添加用户
    Integer addUser(SysUser user);
    //5.修改用户头像
    void updateUserImage(Integer userId, FileUploader uploader);
    //6.修改用户
    void updateUser(SysUser user);
    //7.删除用户
    void deleteUser(Integer id);
    //8.批量删除用户
    void batachDeleteUser(Integer[] ids);
    //9.用户密码进行编码处理。
    default void encodePassword(SysUser user){
        String oldPS = user.getPassword();
        BCryptPasswordEncoder ENC = new BCryptPasswordEncoder();
        String newPS = ENC.encode(oldPS);
        user.setPassword( newPS );
    }
}
